3.8.22 \(\int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))} \, dx\) [722]

Optimal. Leaf size=117 \[ \frac {(3 A-i B) x}{8 a^2 c}-\frac {i A-B}{8 a^2 c f (i-\tan (e+f x))^2}-\frac {A}{4 a^2 c f (i-\tan (e+f x))}+\frac {A-i B}{8 a^2 c f (i+\tan (e+f x))} \]

[Out]

1/8*(3*A-I*B)*x/a^2/c+1/8*(-I*A+B)/a^2/c/f/(I-tan(f*x+e))^2-1/4*A/a^2/c/f/(I-tan(f*x+e))+1/8*(A-I*B)/a^2/c/f/(
I+tan(f*x+e))

________________________________________________________________________________________

Rubi [A]
time = 0.14, antiderivative size = 117, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 41, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.073, Rules used = {3669, 78, 209} \begin {gather*} \frac {A-i B}{8 a^2 c f (\tan (e+f x)+i)}-\frac {-B+i A}{8 a^2 c f (-\tan (e+f x)+i)^2}+\frac {x (3 A-i B)}{8 a^2 c}-\frac {A}{4 a^2 c f (-\tan (e+f x)+i)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(A + B*Tan[e + f*x])/((a + I*a*Tan[e + f*x])^2*(c - I*c*Tan[e + f*x])),x]

[Out]

((3*A - I*B)*x)/(8*a^2*c) - (I*A - B)/(8*a^2*c*f*(I - Tan[e + f*x])^2) - A/(4*a^2*c*f*(I - Tan[e + f*x])) + (A
 - I*B)/(8*a^2*c*f*(I + Tan[e + f*x]))

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))} \, dx &=\frac {(a c) \text {Subst}\left (\int \frac {A+B x}{(a+i a x)^3 (c-i c x)^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(a c) \text {Subst}\left (\int \left (\frac {i (A+i B)}{4 a^3 c^2 (-i+x)^3}-\frac {A}{4 a^3 c^2 (-i+x)^2}+\frac {-A+i B}{8 a^3 c^2 (i+x)^2}+\frac {3 A-i B}{8 a^3 c^2 \left (1+x^2\right )}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {i A-B}{8 a^2 c f (i-\tan (e+f x))^2}-\frac {A}{4 a^2 c f (i-\tan (e+f x))}+\frac {A-i B}{8 a^2 c f (i+\tan (e+f x))}+\frac {(3 A-i B) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{8 a^2 c f}\\ &=\frac {(3 A-i B) x}{8 a^2 c}-\frac {i A-B}{8 a^2 c f (i-\tan (e+f x))^2}-\frac {A}{4 a^2 c f (i-\tan (e+f x))}+\frac {A-i B}{8 a^2 c f (i+\tan (e+f x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 1.08, size = 129, normalized size = 1.10 \begin {gather*} -\frac {-7 A+i B+12 i A f x+4 B f x+2 (A-3 i B) \cos (2 (e+f x))+(3 i A+B) \sec (e+f x) \sin (3 (e+f x))+6 i A \tan (e+f x)-2 B \tan (e+f x)-12 A f x \tan (e+f x)+4 i B f x \tan (e+f x)}{32 a^2 c f (-i+\tan (e+f x))} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(A + B*Tan[e + f*x])/((a + I*a*Tan[e + f*x])^2*(c - I*c*Tan[e + f*x])),x]

[Out]

-1/32*(-7*A + I*B + (12*I)*A*f*x + 4*B*f*x + 2*(A - (3*I)*B)*Cos[2*(e + f*x)] + ((3*I)*A + B)*Sec[e + f*x]*Sin
[3*(e + f*x)] + (6*I)*A*Tan[e + f*x] - 2*B*Tan[e + f*x] - 12*A*f*x*Tan[e + f*x] + (4*I)*B*f*x*Tan[e + f*x])/(a
^2*c*f*(-I + Tan[e + f*x]))

________________________________________________________________________________________

Maple [A]
time = 0.23, size = 106, normalized size = 0.91

method result size
derivativedivides \(\frac {\left (\frac {3 i A}{16}+\frac {B}{16}\right ) \ln \left (i+\tan \left (f x +e \right )\right )-\frac {-\frac {A}{8}+\frac {i B}{8}}{i+\tan \left (f x +e \right )}-\frac {-\frac {B}{4}+\frac {i A}{4}}{2 \left (-i+\tan \left (f x +e \right )\right )^{2}}+\left (-\frac {3 i A}{16}-\frac {B}{16}\right ) \ln \left (-i+\tan \left (f x +e \right )\right )+\frac {A}{-4 i+4 \tan \left (f x +e \right )}}{f \,a^{2} c}\) \(106\)
default \(\frac {\left (\frac {3 i A}{16}+\frac {B}{16}\right ) \ln \left (i+\tan \left (f x +e \right )\right )-\frac {-\frac {A}{8}+\frac {i B}{8}}{i+\tan \left (f x +e \right )}-\frac {-\frac {B}{4}+\frac {i A}{4}}{2 \left (-i+\tan \left (f x +e \right )\right )^{2}}+\left (-\frac {3 i A}{16}-\frac {B}{16}\right ) \ln \left (-i+\tan \left (f x +e \right )\right )+\frac {A}{-4 i+4 \tan \left (f x +e \right )}}{f \,a^{2} c}\) \(106\)
risch \(-\frac {i x B}{8 a^{2} c}+\frac {3 x A}{8 a^{2} c}-\frac {{\mathrm e}^{-4 i \left (f x +e \right )} B}{32 a^{2} c f}+\frac {i {\mathrm e}^{-4 i \left (f x +e \right )} A}{32 a^{2} c f}-\frac {\cos \left (2 f x +2 e \right ) B}{8 a^{2} c f}+\frac {i \cos \left (2 f x +2 e \right ) A}{8 a^{2} c f}+\frac {A \sin \left (2 f x +2 e \right )}{4 a^{2} c f}\) \(130\)
norman \(\frac {\frac {\left (-i B +3 A \right ) x}{8 a c}-\frac {-i A +B}{4 a c f}+\frac {\left (-i B +3 A \right ) \left (\tan ^{3}\left (f x +e \right )\right )}{8 a c f}+\frac {\left (-i B +3 A \right ) x \left (\tan ^{2}\left (f x +e \right )\right )}{4 a c}+\frac {\left (-i B +3 A \right ) x \left (\tan ^{4}\left (f x +e \right )\right )}{8 a c}+\frac {\left (i B +5 A \right ) \tan \left (f x +e \right )}{8 a c f}}{a \left (1+\tan ^{2}\left (f x +e \right )\right )^{2}}\) \(154\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))^2/(c-I*c*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f/a^2/c*((3/16*I*A+1/16*B)*ln(I+tan(f*x+e))-(-1/8*A+1/8*I*B)/(I+tan(f*x+e))-1/2*(-1/4*B+1/4*I*A)/(-I+tan(f*x
+e))^2+(-3/16*I*A-1/16*B)*ln(-I+tan(f*x+e))+1/4*A/(-I+tan(f*x+e)))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))^2/(c-I*c*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

Fricas [A]
time = 1.80, size = 83, normalized size = 0.71 \begin {gather*} \frac {{\left (4 \, {\left (3 \, A - i \, B\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} - 2 \, {\left (i \, A + B\right )} e^{\left (6 i \, f x + 6 i \, e\right )} - 2 \, {\left (-3 i \, A + B\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, A - B\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{32 \, a^{2} c f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))^2/(c-I*c*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/32*(4*(3*A - I*B)*f*x*e^(4*I*f*x + 4*I*e) - 2*(I*A + B)*e^(6*I*f*x + 6*I*e) - 2*(-3*I*A + B)*e^(2*I*f*x + 2*
I*e) + I*A - B)*e^(-4*I*f*x - 4*I*e)/(a^2*c*f)

________________________________________________________________________________________

Sympy [A]
time = 0.28, size = 296, normalized size = 2.53 \begin {gather*} \begin {cases} \frac {\left (\left (256 i A a^{4} c^{2} f^{2} e^{2 i e} - 256 B a^{4} c^{2} f^{2} e^{2 i e}\right ) e^{- 4 i f x} + \left (1536 i A a^{4} c^{2} f^{2} e^{4 i e} - 512 B a^{4} c^{2} f^{2} e^{4 i e}\right ) e^{- 2 i f x} + \left (- 512 i A a^{4} c^{2} f^{2} e^{8 i e} - 512 B a^{4} c^{2} f^{2} e^{8 i e}\right ) e^{2 i f x}\right ) e^{- 6 i e}}{8192 a^{6} c^{3} f^{3}} & \text {for}\: a^{6} c^{3} f^{3} e^{6 i e} \neq 0 \\x \left (- \frac {3 A - i B}{8 a^{2} c} + \frac {\left (A e^{6 i e} + 3 A e^{4 i e} + 3 A e^{2 i e} + A - i B e^{6 i e} - i B e^{4 i e} + i B e^{2 i e} + i B\right ) e^{- 4 i e}}{8 a^{2} c}\right ) & \text {otherwise} \end {cases} + \frac {x \left (3 A - i B\right )}{8 a^{2} c} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))**2/(c-I*c*tan(f*x+e)),x)

[Out]

Piecewise((((256*I*A*a**4*c**2*f**2*exp(2*I*e) - 256*B*a**4*c**2*f**2*exp(2*I*e))*exp(-4*I*f*x) + (1536*I*A*a*
*4*c**2*f**2*exp(4*I*e) - 512*B*a**4*c**2*f**2*exp(4*I*e))*exp(-2*I*f*x) + (-512*I*A*a**4*c**2*f**2*exp(8*I*e)
 - 512*B*a**4*c**2*f**2*exp(8*I*e))*exp(2*I*f*x))*exp(-6*I*e)/(8192*a**6*c**3*f**3), Ne(a**6*c**3*f**3*exp(6*I
*e), 0)), (x*(-(3*A - I*B)/(8*a**2*c) + (A*exp(6*I*e) + 3*A*exp(4*I*e) + 3*A*exp(2*I*e) + A - I*B*exp(6*I*e) -
 I*B*exp(4*I*e) + I*B*exp(2*I*e) + I*B)*exp(-4*I*e)/(8*a**2*c)), True)) + x*(3*A - I*B)/(8*a**2*c)

________________________________________________________________________________________

Giac [A]
time = 0.66, size = 169, normalized size = 1.44 \begin {gather*} \frac {\frac {2 \, {\left (3 i \, A + B\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{a^{2} c} + \frac {2 \, {\left (-3 i \, A - B\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{a^{2} c} - \frac {2 \, {\left (3 \, A \tan \left (f x + e\right ) - i \, B \tan \left (f x + e\right ) + 5 i \, A + 3 \, B\right )}}{a^{2} c {\left (-i \, \tan \left (f x + e\right ) + 1\right )}} + \frac {9 i \, A \tan \left (f x + e\right )^{2} + 3 \, B \tan \left (f x + e\right )^{2} + 26 \, A \tan \left (f x + e\right ) - 6 i \, B \tan \left (f x + e\right ) - 21 i \, A + B}{a^{2} c {\left (\tan \left (f x + e\right ) - i\right )}^{2}}}{32 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))^2/(c-I*c*tan(f*x+e)),x, algorithm="giac")

[Out]

1/32*(2*(3*I*A + B)*log(tan(f*x + e) + I)/(a^2*c) + 2*(-3*I*A - B)*log(tan(f*x + e) - I)/(a^2*c) - 2*(3*A*tan(
f*x + e) - I*B*tan(f*x + e) + 5*I*A + 3*B)/(a^2*c*(-I*tan(f*x + e) + 1)) + (9*I*A*tan(f*x + e)^2 + 3*B*tan(f*x
 + e)^2 + 26*A*tan(f*x + e) - 6*I*B*tan(f*x + e) - 21*I*A + B)/(a^2*c*(tan(f*x + e) - I)^2))/f

________________________________________________________________________________________

Mupad [B]
time = 8.77, size = 129, normalized size = 1.10 \begin {gather*} \frac {\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {3\,A}{8\,a^2\,c}-\frac {B\,1{}\mathrm {i}}{8\,a^2\,c}\right )+{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {B}{8\,a^2\,c}+\frac {A\,3{}\mathrm {i}}{8\,a^2\,c}\right )-\frac {B}{4\,a^2\,c}+\frac {A\,1{}\mathrm {i}}{4\,a^2\,c}}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^3\,1{}\mathrm {i}+{\mathrm {tan}\left (e+f\,x\right )}^2+\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}+1\right )}-\frac {x\,\left (B+A\,3{}\mathrm {i}\right )\,1{}\mathrm {i}}{8\,a^2\,c} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + B*tan(e + f*x))/((a + a*tan(e + f*x)*1i)^2*(c - c*tan(e + f*x)*1i)),x)

[Out]

(tan(e + f*x)*((3*A)/(8*a^2*c) - (B*1i)/(8*a^2*c)) + tan(e + f*x)^2*((A*3i)/(8*a^2*c) + B/(8*a^2*c)) + (A*1i)/
(4*a^2*c) - B/(4*a^2*c))/(f*(tan(e + f*x)*1i + tan(e + f*x)^2 + tan(e + f*x)^3*1i + 1)) - (x*(A*3i + B)*1i)/(8
*a^2*c)

________________________________________________________________________________________